package com.example.hrsystem.workflow.model;

import androidx.room.Entity;
import androidx.room.PrimaryKey;
import androidx.room.TypeConverters;

import com.example.hrsystem.data.source.DateTypeConverters;

import java.util.Date;

/**
 * 节点执行记录实体类
 * 记录流程实例中各个节点的执行情况
 */
@Entity(tableName = "node_executions")
public class NodeExecution {
    @PrimaryKey(autoGenerate = true)
    private int id;

    // 关联的流程实例ID
    private int processInstanceId;
    
    // 节点ID（在流程定义中的唯一标识）
    private String nodeId;
    
    // 节点名称
    private String nodeName;
    
    // 节点类型（START, TASK, GATEWAY, END等）
    private String nodeType;
    
    // 执行状态 (PENDING, ACTIVE, COMPLETED, ERROR)
    private String status;
    
    // 执行开始时间
    @TypeConverters(DateTypeConverters.class)
    private Date startTime;
    
    // 执行结束时间
    @TypeConverters(DateTypeConverters.class)
    private Date endTime;
    
    // 执行人ID
    private Integer executorId;

    // 构造函数
    public NodeExecution() {}

    // Getter和Setter方法
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getProcessInstanceId() {
        return processInstanceId;
    }

    public void setProcessInstanceId(int processInstanceId) {
        this.processInstanceId = processInstanceId;
    }

    public String getNodeId() {
        return nodeId;
    }

    public void setNodeId(String nodeId) {
        this.nodeId = nodeId;
    }

    public String getNodeName() {
        return nodeName;
    }

    public void setNodeName(String nodeName) {
        this.nodeName = nodeName;
    }

    public String getNodeType() {
        return nodeType;
    }

    public void setNodeType(String nodeType) {
        this.nodeType = nodeType;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Integer getExecutorId() {
        return executorId;
    }

    public void setExecutorId(Integer executorId) {
        this.executorId = executorId;
    }
}